Skip to content

fix(dock): prevent menu hide after touch long-press#1651

Open
MyLeeJiEun wants to merge 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:fork-from-master-0624-fix-issue-367313
Open

fix(dock): prevent menu hide after touch long-press#1651
MyLeeJiEun wants to merge 1 commit into
linuxdeepin:masterfrom
MyLeeJiEun:fork-from-master-0624-fix-issue-367313

Conversation

@MyLeeJiEun

@MyLeeJiEun MyLeeJiEun commented Jun 24, 2026

Copy link
Copy Markdown
Contributor
  1. Add touchLongPressed flag to track touch long-press state
  2. Skip mouse release handler when touch long-press was active
  3. Reset flag on touch canceled to avoid stale state

Log: Fix right-click menu auto-hiding after touch long-press on taskbar

fix(dock): 修复长按任务栏后松手右键菜单自动隐藏的问题

  1. 添加 touchLongPressed 标志位以跟踪触摸长按状态
  2. 触摸长按激活时跳过鼠标释放事件的处理
  3. 触摸取消时重置标志位,避免状态残留

Log: 修复长按任务栏应用和空白区域松开手指后右键菜单面板自动隐藏的问题
PMS: BUG-367313

Summary by Sourcery

Bug Fixes:

  • Fix dock right-click menu auto-hiding when lifting finger after a long-press on touch devices.

1. Add touchLongPressed flag to track touch long-press state
2. Skip mouse release handler when touch long-press was active
3. Reset flag on touch canceled to avoid stale state

Log: Fix right-click menu auto-hiding after touch long-press on taskbar

fix(dock): 修复长按任务栏后松手右键菜单自动隐藏的问题

1. 添加 touchLongPressed 标志位以跟踪触摸长按状态
2. 触摸长按激活时跳过鼠标释放事件的处理
3. 触摸取消时重置标志位,避免状态残留

Log: 修复长按任务栏应用和空白区域松开手指后右键菜单面板自动隐藏的问题
PMS: BUG-367313
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: MyLeeJiEun

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-ci-robot

Copy link
Copy Markdown

Hi @MyLeeJiEun. Thanks for your PR.

I'm waiting for a linuxdeepin member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@sourcery-ai

sourcery-ai Bot commented Jun 24, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Introduces a touchLongPressed state on the dock container’s touch handler to distinguish between simple taps and long-presses, ensuring the right-click menu is not auto-hidden when a long-press-initiated menu is followed by a touch release, and properly resets this state on cancellation.

Sequence diagram for touch long-press handling on dock

sequenceDiagram
    actor User
    participant TouchHandler
    participant DockContainer
    participant MenuHelper
    participant DockMenuLoader

    User->>TouchHandler: onLongPressed
    TouchHandler->>DockContainer: touchLongPressed = true
    TouchHandler->>MenuHelper: closeCurrent()
    TouchHandler->>DockMenuLoader: active = true
    TouchHandler->>DockContainer: requestShowDockMenu()

    User->>TouchHandler: onTapped
    TouchHandler->>DockContainer: check touchLongPressed
    alt [touchLongPressed == true]
        TouchHandler->>DockContainer: touchLongPressed = false
        TouchHandler-->>MenuHelper: skip closeCurrent()
    else [touchLongPressed == false]
        TouchHandler->>MenuHelper: closeCurrent()
        TouchHandler->>DockMenuLoader: active = true
        TouchHandler->>DockContainer: requestShowDockMenu()
    end

    User->>TouchHandler: onCanceled
    TouchHandler->>DockContainer: touchLongPressed = false
Loading

File-Level Changes

Change Details Files
Track and handle touch long-press state to avoid triggering tap behavior after a long-press and prevent the dock context menu from auto-hiding.
  • Add a touchLongPressed boolean property on the dockContainer to track whether a touch long-press occurred.
  • Guard the TapHandler.onTapped logic by checking touchLongPressed, consuming the first tap after a long-press and resetting the flag instead of opening/closing menus again.
  • Set touchLongPressed to true in TapHandler.onLongPressed when opening the dock context menu from a long-press.
  • Reset touchLongPressed to false in TapHandler.onCanceled to avoid stale state when a touch interaction is canceled.
panels/dock/package/main.qml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants